Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: マナが無くなったら掘れなくするパッシブスキルを追加 #2370

Open
wants to merge 26 commits into
base: 1_18
Choose a base branch
from

Conversation

kuroma6666
Copy link
Contributor

@kuroma6666 kuroma6666 commented Aug 31, 2024

close #1964


このPRの変更点と理由:

主な変更点

  • パッシブスキルに対して、スキルをONにしている際にマナを消費しきった際に整地スキルによってブロック破壊しない設定を追加

補足情報:

  • デフォルト設定値はOFF設定とする(初心者プレイヤー詰み防止)
  • パッシブスキル設定は永続化することとしました

@kuroma6666 kuroma6666 force-pushed the feat-digging-stop-mana-fully-consumed branch 2 times, most recently from 14a859f to 571abd3 Compare September 14, 2024 17:30
@kuroma6666 kuroma6666 marked this pull request as ready for review September 14, 2024 17:38
@kuroma6666
Copy link
Contributor Author

@rito528
ご確認よろしくお願いします。

Copy link
Member

@rito528 rito528 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop ブランチの変更を取り込んでしまっているようなので、 git rebase --rebase-merges 1_18 などを実行して develop ブランチの変更をコミット履歴から消していただけると助かります🙇‍♂️🙇‍♂️

@kuroma6666
Copy link
Contributor Author

了解です。

@kuroma6666 kuroma6666 force-pushed the feat-digging-stop-mana-fully-consumed branch 2 times, most recently from bb09299 to 509644b Compare September 15, 2024 06:27
@kuroma6666 kuroma6666 force-pushed the feat-digging-stop-mana-fully-consumed branch from 509644b to e7c7cd3 Compare September 15, 2024 06:46
@kuroma6666
Copy link
Contributor Author

@rito528
developブランチの変更を取り込んでしまっていた内容については削除しました。

Copy link
Member

@rito528 rito528 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一旦2つ変更をお願いします

@kuroma6666 kuroma6666 requested a review from rito528 September 21, 2024 07:48
@kuroma6666
Copy link
Contributor Author

kuroma6666 commented Sep 21, 2024

一旦2つ変更をお願いします

@rito528
一旦変更かけました

@kuroma6666 kuroma6666 requested a review from rito528 September 22, 2024 13:19
@kuroma6666
Copy link
Contributor Author

@rito528
レビュー内容について対応実施しました、再確認お願いします。

Copy link
Member

@rito528 rito528 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テーブル構成が変わることで今と実装がかなり変わりそうなので、一度以下の内容の変更をお願いします!

@kuroma6666
Copy link
Contributor Author

テーブル構成が変わることで今と実装がかなり変わりそうなので、一度以下の内容の変更をお願いします!

@rito528
一旦変更をかけたので、確認お願いします。

@kuroma6666
Copy link
Contributor Author

@rito528
ご指摘の内容を反映しました。
再度レビューよろしくお願いします。

@kuroma6666 kuroma6666 requested a review from rito528 December 14, 2024 13:38
Copy link
Member

@rito528 rito528 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM.

再レビュー申請前に sbt scalafixAll; scalafmtAll; を実行してもらえると助かります!

): RepositoryDefinition[F, Player, Ref[F, BreakSuppressionPreference]] =
RefDictBackedRepositoryDefinition
.usingUuidRefDict[F, Player, BreakSuppressionPreference](persistence)(
BreakSuppressionPreference(doBreakSuppression = false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは Repository に保存する場合の初期値を示していますが、doBreakSuppression のデフォルト値が false であるということがドメインとして定義されているので、そこに合わせると良いと思います!

Suggested change
BreakSuppressionPreference(doBreakSuppression = false)
BreakSuppressionPreference.initial

Comment on lines +16 to +22
val doBreakSuppression = DB.readOnly { implicit session =>
sql"SELECT do_break_suppression_due_to_mana FROM player_break_suppression_preference WHERE uuid = ${key.toString}"
.map(rs => rs.boolean("do_break_suppression_due_to_mana"))
.single()
}

doBreakSuppression.map(BreakSuppressionPreference)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val doBreakSuppression = DB.readOnly { implicit session =>
sql"SELECT do_break_suppression_due_to_mana FROM player_break_suppression_preference WHERE uuid = ${key.toString}"
.map(rs => rs.boolean("do_break_suppression_due_to_mana"))
.single()
}
doBreakSuppression.map(BreakSuppressionPreference)
DB.readOnly { implicit session =>
sql"SELECT do_break_suppression_due_to_mana FROM player_break_suppression_preference WHERE uuid = ${key.toString}"
.map(_.boolean("do_break_suppression_due_to_mana"))
.single()
.map(BreakSuppressionPreference)
}

@@ -21,7 +21,6 @@ case class LevelCappedManaAmount private (manaAmount: ManaAmount, level: SeichiL
)(manaMultiplier: ManaMultiplier): Option[LevelCappedManaAmount] = {
manaAmount.tryUse(amount)(manaMultiplier).map(LevelCappedManaAmount(_, level))
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +43 to +45
breakSuppressionPreferenceRepository(player).update(pref =>
pref.copy(doBreakSuppression = !pref.doBreakSuppression)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
breakSuppressionPreferenceRepository(player).update(pref =>
pref.copy(doBreakSuppression = !pref.doBreakSuppression)
)
breakSuppressionPreferenceRepository(player)
.update(_.toggleBreakSuppression())

Comment on lines +239 to +240
originalBreakStopConfig <- breakSuppressionPreferenceAPI.isBreakSuppressionEnabled(player)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
originalBreakStopConfig <- breakSuppressionPreferenceAPI.isBreakSuppressionEnabled(player)
isBreakSuppressionEnabled <- breakSuppressionPreferenceAPI.isBreakSuppressionEnabled(player)

Comment on lines +262 to +272
if (!originalBreakStopConfig) {
SequentialEffect(
MessageEffect(s"${GREEN}マナが切れたらブロック破壊を止めるスキルを有効化しました。"),
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 1f)
)
} else {
SequentialEffect(
MessageEffect(s"${RED}マナが切れたらブロック破壊を止めるスキルを無効化しました。"),
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 0.5f)
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下のように書いたほうが、より読みやすくなると思います

Suggested change
if (!originalBreakStopConfig) {
SequentialEffect(
MessageEffect(s"${GREEN}マナが切れたらブロック破壊を止めるスキルを有効化しました"),
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 1f)
)
} else {
SequentialEffect(
MessageEffect(s"${RED}マナが切れたらブロック破壊を止めるスキルを無効化しました"),
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 0.5f)
)
}
if (originalBreakStopConfig) {
SequentialEffect(
MessageEffect(s"${RED}マナが切れたらブロック破壊を止めるスキルを無効化しました"),
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 0.5f)
)
} else {
SequentialEffect(
MessageEffect(s"${GREEN}マナが切れたらブロック破壊を止めるスキルを有効化しました"),
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 1f)
)
}

* マナ切れブロック破壊設定が `true` になっている場合、プレイヤーに破壊抑制メッセージを送信する。
* @param player マナ切れブロック破壊停止設定を取得するプレイヤー
*/
def isBreakBlockManaFullyConsumed(player: Player): IO[Boolean] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

見た限り PlayerBlockBreakListener 内の定義でしか使われていないようなので private にして良いと思います!(私の見落としだったらそのままで大丈夫です!)

Suggested change
def isBreakBlockManaFullyConsumed(player: Player): IO[Boolean] = {
private def isBreakBlockManaFullyConsumed(player: Player): IO[Boolean] = {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants